﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using AlbumDesigner.Models.Enums;
using System.ComponentModel.DataAnnotations.Schema;

namespace Keepo.Models
{
    public class AlbumSection
    {
        public int AlbumSectionId { get; set; }

        [MaxLength(30)]
        public string Title { get; set; }

        public int AlbumId { get; set; }
        public virtual Album Album { get; set; }

        public int SectionIdx { get; set; }

        public int AlbumSectionTypeId { get; set; }
        public virtual AlbumSectionType AlbumSectionType { get; set; }

        public int AlbumSectionStatusId { get; set; }
        public virtual AlbumSectionStatus AlbumSectionStatus { get; set; }

        public int AlbumSectionLockStatusId { get; set; }
        public virtual AlbumSectionLockStatus AlbumSectionLockStatus { get; set; }

        [ForeignKey("Editor")]
        public int EditorId { get; set; }
        public virtual User Editor { get; set; }

        public int PagesCount { get; set; }
        public virtual ICollection<AlbumPage> AlbumPages { get; set; }

        public bool isClassSection()
        {
            return AlbumSectionTypeId == (int) AlbumSectionTypeEnum.Class;
        }

        public bool isCoverSection()
        {
            return AlbumSectionTypeId == (int) AlbumSectionTypeEnum.Cover;
        }
    }
}